#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
    vector<int> f {1};
    for (int i = 1; i < 10; ++i) {
        f.push_back(i * f[i - 1]);
    }
    reverse(f.begin(), f.end());

    vector<int> a;
    int num = 1000000 - 1;
    for (int i = 0; i < 10; ++i) {
        a.push_back(num / f[i]);
        num -= f[i] * a[a.size() - 1];
    }

    vector<int> b(10);
    iota(b.begin(), b.end(), 0);
    for (auto e : a) {
        cout << b[e];
        b.erase(b.begin() + e);
    }
    cout << endl; // 2783915460
}